{
  "properties" : { },
  "id" : "copy1730250822992d93849",
  "script" : null,
  "groupId" : "c0cf605f74e34bc6953194a869f4a6cd",
  "name" : "FX_PREC统计累计降雨数据",
  "createTime" : 1732780546966,
  "updateTime" : 1730861446055,
  "lock" : null,
  "createBy" : "admin",
  "updateBy" : "admin",
  "path" : "/stationprec",
  "method" : "GET",
  "parameters" : [ {
    "name" : "stationkey",
    "value" : "",
    "description" : "必须填写 站ID",
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  }, {
    "name" : "btime",
    "value" : "2024-10-20T13:00:00",
    "description" : "开始时间",
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : "pass",
    "error" : null,
    "expression" : null,
    "children" : null
  }, {
    "name" : "etime",
    "value" : "2024-10-21T13:00:00",
    "description" : "结束时间",
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : "pass",
    "error" : null,
    "expression" : null,
    "children" : null
  }, {
    "name" : "page",
    "value" : "1",
    "description" : null,
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  }, {
    "name" : "size",
    "value" : "20",
    "description" : null,
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  }, {
    "name" : "regioncode",
    "value" : "",
    "description" : null,
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  }, {
    "name" : "israin",
    "value" : "true",
    "description" : null,
    "required" : false,
    "dataType" : "Boolean",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  } ],
  "options" : [ ],
  "requestBody" : "",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : "{\n    \"code\": 0,\n    \"message\": \"success\",\n    \"data\": {\n        \"total\": 299,\n        \"list\": [\n            {\n                \"stationKey\": \"E1062\",\n                \"lat\": 44.0097,\n                \"lon\": 125.2492,\n                \"high\": 212,\n                \"city\": \"长春市\",\n                \"stationName\": \"宽城兰家\",\n                \"cnty\": \"市辖区\",\n                \"code\": \"220101\",\n                \"orgid\": \"220001001\",\n                \"prec\": 0.2\n            },\n            {\n                \"stationKey\": \"E1078\",\n                \"lat\": 43.9161,\n                \"lon\": 125.1456,\n                \"high\": 218,\n                \"city\": \"长春市\",\n                \"stationName\": \"绿园岳家\",\n                \"cnty\": \"市辖区\",\n                \"code\": \"220101\",\n                \"orgid\": \"220001001\",\n                \"prec\": 0.3\n            },\n            {\n                \"stationKey\": \"E1010\",\n                \"lat\": 43.8567,\n                \"lon\": 125.3069,\n                \"high\": 226,\n                \"city\": \"长春市\",\n                \"stationName\": \"朝阳南湖公园\",\n                \"cnty\": \"市辖区\",\n                \"code\": \"220101\",\n                \"orgid\": \"220001001\",\n                \"prec\": 0.1\n            },\n            {\n                \"stationKey\": \"E1026\",\n                \"lat\": 43.8356,\n                \"lon\": 125.3842,\n                \"high\": 217,\n                \"city\": \"长春市\",\n                \"stationName\": \"二道会展中心\",\n                \"cnty\": \"市辖区\",\n                \"code\": \"220101\",\n                \"orgid\": \"220001001\",\n                \"prec\": 0.1\n            },\n            {\n                \"stationKey\": \"E1125\",\n                \"lat\": 44.2819,\n                \"lon\": 126.2725,\n                \"high\": 259,\n                \"city\": \"长春市\",\n                \"stationName\": \"九台红石\",\n                \"cnty\": \"九台区\",\n                \"code\": \"220113\",\n                \"orgid\": \"220001013\",\n                \"prec\": 0.1\n            },\n            {\n                \"stationKey\": \"E1128\",\n                \"lat\": 44.4642,\n                \"lon\": 126.0169,\n                \"high\": 202,\n                \"city\": \"长春市\",\n                \"stationName\": \"九台敬老院\",\n                \"cnty\": \"九台区\",\n                \"code\": \"220113\",\n                \"orgid\": \"220001013\",\n                \"prec\": 0.1\n            },\n            {\n                \"stationKey\": \"E0009\",\n                \"lat\": 44.1053,\n                \"lon\": 125.7058,\n                \"high\": 207,\n                \"city\": \"长春市\",\n                \"stationName\": \"龙嘉阎家岗子\",\n                \"cnty\": \"九台区\",\n                \"code\": \"220113\",\n                \"orgid\": \"220001013\",\n                \"prec\": 0.1\n            },\n            {\n                \"stationKey\": \"E1101\",\n                \"lat\": 43.9061,\n                \"lon\": 125.8883,\n                \"high\": 194.8,\n                \"city\": \"长春市\",\n                \"stationName\": \"九台锦绣\",\n                \"cnty\": \"九台区\",\n                \"code\": \"220113\",\n                \"orgid\": \"220001013\",\n                \"prec\": 0.1\n            },\n            {\n                \"stationKey\": \"E1217\",\n                \"lat\": 44.8489,\n                \"lon\": 125.5908,\n                \"high\": 219,\n                \"city\": \"长春市\",\n                \"stationName\": \"农安青山口\",\n                \"cnty\": \"农安县\",\n                \"code\": \"220122\",\n                \"orgid\": \"220001022\",\n                \"prec\": 0.4\n            },\n            {\n                \"stationKey\": \"E1221\",\n                \"lat\": 44.8169,\n                \"lon\": 125.4667,\n                \"high\": 160,\n                \"city\": \"长春市\",\n                \"stationName\": \"农安黄鱼圈\",\n                \"cnty\": \"农安县\",\n                \"code\": \"220122\",\n                \"orgid\": \"220001022\",\n                \"prec\": 0.1\n            },\n            {\n                \"stationKey\": \"E1216\",\n                \"lat\": 44.7736,\n                \"lon\": 125.3433,\n                \"high\": 204,\n                \"city\": \"长春市\",\n                \"stationName\": \"农安小城子\",\n                \"cnty\": \"农安县\",\n                \"code\": \"220122\",\n                \"orgid\": \"220001022\",\n                \"prec\": 0.1\n            },\n            {\n                \"stationKey\": \"E1213\",\n                \"lat\": 44.6133,\n                \"lon\": 125.3975,\n                \"high\": 173,\n                \"city\": \"长春市\",\n                \"stationName\": \"农安万金塔\",\n                \"cnty\": \"农安县\",\n                \"code\": \"220122\",\n                \"orgid\": \"220001022\",\n                \"prec\": 0.1\n            },\n            {\n                \"stationKey\": \"E1208\",\n                \"lat\": 44.4075,\n                \"lon\": 124.6353,\n                \"high\": 257,\n                \"city\": \"长春市\",\n                \"stationName\": \"农安伏龙泉镇\",\n                \"cnty\": \"农安县\",\n                \"code\": \"220122\",\n                \"orgid\": \"220001022\",\n                \"prec\": 0.1\n            },\n            {\n                \"stationKey\": \"E1205\",\n                \"lat\": 44.2461,\n                \"lon\": 124.6586,\n                \"high\": 256,\n                \"city\": \"长春市\",\n                \"stationName\": \"农安新阳\",\n                \"cnty\": \"农安县\",\n                \"code\": \"220122\",\n                \"orgid\": \"220001022\",\n                \"prec\": 0.8\n            },\n            {\n                \"stationKey\": \"E1203\",\n                \"lat\": 44.0681,\n                \"lon\": 124.9389,\n                \"high\": 190,\n                \"city\": \"长春市\",\n                \"stationName\": \"农安太平池水库\",\n                \"cnty\": \"农安县\",\n                \"code\": \"220122\",\n                \"orgid\": \"220001022\",\n                \"prec\": 0.1\n            },\n            {\n                \"stationKey\": \"E1240\",\n                \"lat\": 44.4842,\n                \"lon\": 124.6028,\n                \"high\": 227,\n                \"city\": \"长春市\",\n                \"stationName\": \"农安小巨宝\",\n                \"cnty\": \"农安县\",\n                \"code\": \"220122\",\n                \"orgid\": \"220001022\",\n                \"prec\": 0.1\n            },\n            {\n                \"stationKey\": \"E1243\",\n                \"lat\": 44.4097,\n                \"lon\": 125.0139,\n                \"high\": 189,\n                \"city\": \"长春市\",\n                \"stationName\": \"农安朝阳沟\",\n                \"cnty\": \"农安县\",\n                \"code\": \"220122\",\n                \"orgid\": \"220001022\",\n                \"prec\": 0.3\n            },\n            {\n                \"stationKey\": \"E1245\",\n                \"lat\": 44.3481,\n                \"lon\": 125.1161,\n                \"high\": 188,\n                \"city\": \"长春市\",\n                \"stationName\": \"农安王成窝堡\",\n                \"cnty\": \"农安县\",\n                \"code\": \"220122\",\n                \"orgid\": \"220001022\",\n                \"prec\": 0.1\n            },\n            {\n                \"stationKey\": \"E1249\",\n                \"lat\": 43.9722,\n                \"lon\": 124.9906,\n                \"high\": 194,\n                \"city\": \"长春市\",\n                \"stationName\": \"农安烧锅\",\n                \"cnty\": \"农安县\",\n                \"code\": \"220122\",\n                \"orgid\": \"220001022\",\n                \"prec\": 0.1\n            },\n            {\n                \"stationKey\": \"E1228\",\n                \"lat\": 44.5019,\n                \"lon\": 125.1006,\n                \"high\": 205,\n                \"city\": \"长春市\",\n                \"stationName\": \"农安兴隆\",\n                \"cnty\": \"农安县\",\n                \"code\": \"220122\",\n                \"orgid\": \"220001022\",\n                \"prec\": 0.1\n            }\n        ]\n    },\n    \"timestamp\": 1730861421518,\n    \"executeTime\": 998\n}",
  "description" : null,
  "requestBodyDefinition" : null,
  "responseBodyDefinition" : {
    "name" : "",
    "value" : "",
    "description" : "",
    "required" : false,
    "dataType" : "Object",
    "type" : null,
    "defaultValue" : null,
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ {
      "name" : "code",
      "value" : "1",
      "description" : "",
      "required" : false,
      "dataType" : "Integer",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "message",
      "value" : "success",
      "description" : "",
      "required" : false,
      "dataType" : "String",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "data",
      "value" : "Hello magic-api",
      "description" : "",
      "required" : false,
      "dataType" : "String",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "timestamp",
      "value" : "1723701688631",
      "description" : "",
      "required" : false,
      "dataType" : "Long",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "executeTime",
      "value" : "174",
      "description" : "",
      "required" : false,
      "dataType" : "Integer",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    } ]
  }
}
================================
/**
 *   统计累计降雨数据 
 *  @param   stationkey  查询指定站点编码
 */
var sql = """
   select a.*,b.prec from station_info a
    ,(
    select  stationKey,sum(prec) as prec  from stationdata_hour   
    where 1 = 1 
    
     <if test="stationkey != null and stationkey != ''" > and stationKey = #{stationkey} </if>
     <if test="btime != null and btime != ''\" > and DATE_FORMAT(#{btime}, '%Y-%m-%d %H:%i:%s') <= timeBase </if>
     <if test="etime != null and etime != ''\" > and DATE_FORMAT(#{etime}, '%Y-%m-%d %H:%i:%s') >= timeBase </if>
     and prec < 100 
     group by stationKey) as b
     where a.stationkey = b.stationkey and 1 = 1
    <if test="regioncode != null and regioncode != ''" > and a.orgid LIKE CONCAT(#{regioncode},'%') </if>
        <if test="israin" > and prec > 0 </if>
    order by code 
"""
    
return db.page(sql);